/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package api.gest;

import api.dom.Factura;
import java.util.ArrayList;

/**
 *
 * @author Enrico
 */
public class GestFactura {
    private ArrayList<Factura> mColFacturas = new ArrayList<Factura>();
    private static GestFactura objGestF = null;
    
      public static GestFactura getInstance()
  {
        if (objGestF == null){
            objGestF = new GestFactura();
            }
        return objGestF;
  }
      
      public boolean verificarFactura(Factura xObjF){
          for(Factura f: mColFacturas){
              if(f.getfNumero()==xObjF.getfNumero()){
                 return true;
              }                 
          }
          return false;
      }
      
      public boolean altaFactura(Factura xObjF){
          if(!verificarFactura(xObjF)){
              mColFacturas.add(xObjF);
              return true;
          }
          return false;
      }
      
      public boolean bajaFactura(Factura xObjF){
          mColFacturas.remove(xObjF);
          return true;
      }
      
      public ArrayList<Factura> devolverFacturas(){
          return mColFacturas;
      }
    
}
